#include <bits/stdc++.h>
using namespace std;
#define PI 3.1415926
#define   SQUARE(x) ((x)*(x))
//double SQUARE(double x) { return x*x;}

int main()
{
	int x, y=8;
	double x2, b;
	char c;
	scanf("%d %c",  &x, &c);
	if(x > 1000) y += (x-1000)/500 * 4, y += ((x - 1000) % 500) ?  4 : 0;
	if('y' == c) y += 5;
	printf("%d", y);

  return 0;
}
